package com.luhuiguo.cms.shared.event;

import java.util.List;

import com.google.gwt.event.shared.GwtEvent;
import com.luhuiguo.cms.shared.model.ArticleModel;

public class ArticlesLoadedEvent extends GwtEvent<ArticlesLoadedEventHandler> {

    public static Type<ArticlesLoadedEventHandler> TYPE = new Type<ArticlesLoadedEventHandler>();

    private List<ArticleModel> articles;
    private Long channel;

    public ArticlesLoadedEvent(Long channel, List<ArticleModel> articles) {
        this.channel = channel;
        this.articles = articles;

    }

    public List<ArticleModel> getArticles() {
        return articles;
    }

    public Long getChannel() {
        return channel;
    }

    @Override
    public Type<ArticlesLoadedEventHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(ArticlesLoadedEventHandler handler) {
        handler.onArticlesLoaded(this);
    }

}
